Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Anders Brohäll 295 posts 561 karma points c-trib
    Nov 04, 2013 @ 11:21
    Anders Brohäll
    0

    How do i get RemoteDomainWhiteList (and ImageBaseDir) to support https`?

    Hi,

    Can't seem to be able to figure out how to use RemoteDomainWhiteList or ImageBaseDir with https. 
    That is, the domains i want to call is using the https protocol.

    Example:

    <RemoteDomainWhiteList>
      <Domain>whatever.ext</Domain>
    </RemoteDomainWhiteList>
    or

    <Class Name="realtorthumb" OverridesQueryString="false">
        <ImageBaseDir>https://whatever.ext/</ImageBaseDir>;
    </Class>

     

    What am i missing?

  • Douglas Robar 3570 posts 4711 karma points MVP ∞ admin c-trib
    Nov 04, 2013 @ 12:17
    Douglas Robar
    0

    Hi, Anders,

    Here's how I do it (using ImageGen 2.9.0 Professional) using an image that is available from both http and https via flickr. Let's take it step by step...

    A simple remote request with ImageGen for the regular http image

    http://example.com/imagegen.ashx?width=200&image=http://farm3.staticflickr.com/2890/9799091386_0177832a2d_o.jpg
    

    This will fail because ImageGen requires that you specifically allow remote domains (you don't want your site being used as a resizer for every image on the internet!).

    I'll add an entry to the <RemoteDomainWhiteList> section of the imagegen.config file, like this:

    <RemoteDomainWhiteList>
        <Domain>farm*.staticflickr.com</Domain>
    </RemoteDomainWhiteList>
    

    Notice the * wildcard character. This is new in 2.9.0. In previous versions you have to specify the domain precisely, without any wildcards.

    Now the request will work properly.

    A simple remote request for the secure https image

    A request for the secure image now also works:

    http://example.com/imagegen.ashx?width=200&image=https://farm3.staticflickr.com/2890/9799091386_0177832a2d_o.jpg
    

    Simplification and security with classes

    I don't want to advertise where the images are coming from so I'll use a class in the imagegen.config file hide that with the <ImageBaseDir> setting. I'll also set the width in the class.

    <Class Name="RealtorThumb" OverridesQueryString="true">
      <ImageBaseDir>https://farm3.staticflickr.com/2890/</ImageBaseDir>;
      <Width>100</Width>
    </Class>
    

    I can now use this very simple yet secure ImageGen request:

    http://example.com/imagegen.ashx?class=RealtorThumb&image=9799091386_0177832a2d_o.jpg
    

    cheers,
    doug.

  • Anders Brohäll 295 posts 561 karma points c-trib
    Nov 04, 2013 @ 12:36
    Anders Brohäll
    0

    <= Feeling stupid.

    For some reason i tried to fetch the image with ?file= instead if ?image=.
    My bad. 

  • Douglas Robar 3570 posts 4711 karma points MVP ∞ admin c-trib
    Nov 04, 2013 @ 12:39
    Douglas Robar
    0

    More coffee, my friend, more coffee. :)

    Glad it is sorted out.

    cheers,
    doug.

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies